/****************************************
*多线程管理器模型：
*模式：单例模式
*功能：
*	1.支持线程的添加与管理；
****************************************/

#pragma once
#include "singleton.h"
#include "threadA.h"
#include "threadB.h"
#include "MQTTSub.h"
#include "PortManager.h"
#include "MQTTPub.h"
#include "DataCenter.h"
#include <map>
#include <Theron/Theron.h>


enum ThreadID {
	THREAD_A,
	THREAD_B,
	THREAD_MQTTSUB,
	THREAD_MQTTPUB,
	THREAD_PORT_MANAGER
};

class ThreadManager : public Singleton<ThreadManager>
{
public:
	std::map<int, Theron::Address> ID_ADDRESS_MAP;
	int m_num;
	ThreadManager();
	void start();
	void stop();

private:
	int setThreadID(int id, Theron::Address);


public:
	Theron::Framework m_framework;
	CThreadA *m_threadA = nullptr;
	CThreadB *m_threadB = nullptr;
	CMQTTSub *m_mqttsub = nullptr;
	CMQTTPub *m_mqttpub = nullptr;
	CPortManager *m_portmanager = nullptr;
	vector<int> m_timeid;
};